package com.meng.android.util;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

@SuppressWarnings("rawtypes")
public class CollectionUtils {
	public static boolean isEmpty(List list) {
		if (list != null && !list.isEmpty()) {
			return false;
		}
		return true;
	}

	public static boolean isNotEmpty(List list) {
		return !isEmpty(list);
	}

	public static String mapToString(HashMap map) {
		StringBuilder sb = new StringBuilder("[");
		Iterator entries = map.entrySet().iterator();
		while (entries.hasNext()) {
			Entry thisEntry = (Entry) entries.next();
			Object key = thisEntry.getKey();
			sb.append(key);
			sb.append(": ");
			Object value = thisEntry.getValue();
			sb.append(value);
			sb.append(" ; ");
		}
		sb.append("]");
		return sb.toString();
	}
}